package com.che.software.testato.domain.entity.creation;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.che.software.testato.domain.entity.Element;
import com.che.software.testato.domain.entity.ProceduralArrow;
import com.che.software.testato.domain.enumeration.VariantTypes;

/**
 * Class representing the properties of a variant to be created.
 * 
 * @author Clement HELIOU (clement.heliou@che-software.com).
 * @copyright Che Software.
 * @license GNU General Public License.
 * @see Serializable
 * @since July, 2011.
 * 
 *        This file is part of Testato.
 * 
 *        Testato is free software: you can redistribute it and/or modify it
 *        under the terms of the GNU General Public License as published by the
 *        Free Software Foundation, either version 3 of the License, or (at your
 *        option) any later version.
 * 
 *        Testato is distributed in the hope that it will be useful, but WITHOUT
 *        ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *        FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 *        for more details.
 * 
 *        You should have received a copy of the GNU General Public License
 *        along with Testato. If not, see <http://www.gnu.org/licenses/>.
 * 
 *        Testato's logo is a creation of Arrioch
 *        (http://arrioch.deviantart.com/) and it's distributed under the terms
 *        of the Creative Commons License.
 */
public class VariantCreation implements Serializable {

	/**
	 * Constants.
	 */
	private static final long serialVersionUID = -7144145987791721018L;

	/**
	 * Members.
	 */
	private List<Element> elements = new ArrayList<Element>();
	private List<ProceduralArrow> transitions = new ArrayList<ProceduralArrow>();
	private VariantTypes variantType;

	/**
	 * Default builder.
	 */
	public VariantCreation() {
		super();
	}

	/**
	 * Builder from fields.
	 * 
	 * @param elements the elements list.
	 * @param transitions the transitions list.
	 * @param variantType the variant type.
	 */
	private VariantCreation(List<Element> elements, List<ProceduralArrow> transitions, VariantTypes variantType) {
		super();
		this.elements = elements;
		this.transitions = transitions;
		this.variantType = variantType;
	}

	/**
	 * Builder as a clone factory. Mandatory because the VariantCreation's list
	 * members contained wrapper type members.
	 * 
	 * @param toClone the object to clone.
	 */
	public VariantCreation(VariantCreation toClone) {
		this(new ArrayList<Element>(toClone.elements), new ArrayList<ProceduralArrow>(toClone.transitions), toClone.variantType);
	}

	/**
	 * Adds an element to the elements list.
	 * 
	 * @author Clement HELIOU (clement.heliou@che-software.com).
	 * @param element the element to add.
	 * @since July, 2011.
	 */
	public void addElement(Element element) {
		elements.add(element);
	}

	/**
	 * Add a transition to the transitions list.
	 * 
	 * @author Clement HELIOU (clement.heliou@che-software.com).
	 * @param transition the transition to add.
	 * @since July, 2011.
	 */
	public void addTransition(ProceduralArrow transition) {
		transitions.add(transition);
	}

	/**
	 * Getter for the private field value elements.
	 * 
	 * @return the elements field value.
	 */
	public List<Element> getElements() {
		return elements;
	}

	/**
	 * Setting a value to the elements field.
	 * 
	 * @param elements the value to set.
	 */
	public void setElements(List<Element> elements) {
		this.elements = elements;
	}

	/**
	 * Getter for the private field value variantType.
	 * 
	 * @return the variantType field value.
	 */
	public VariantTypes getVariantType() {
		return variantType;
	}

	/**
	 * Setting a value to the variantType field.
	 * 
	 * @param variantType the value to set.
	 */
	public void setVariantType(VariantTypes variantType) {
		this.variantType = variantType;
	}

	/**
	 * Getter for the private field value transitions.
	 * 
	 * @return the transitions field value.
	 */
	public List<ProceduralArrow> getTransitions() {
		return transitions;
	}

	/**
	 * Setting a value to the transitions field.
	 * 
	 * @param transitions the value to set.
	 */
	public void setTransitions(List<ProceduralArrow> transitions) {
		this.transitions = transitions;
	}
}